let GameControl =require("GameControl");

cc.Class({
    extends: cc.Component,

    properties: {

    },

    // LIFE-CYCLE CALLBACKS:

     onLoad () {

         cc.systemEvent.on(cc.SystemEvent.EventType.KEY_UP,this.onKeyUp,this);

     },

    start () {

    },

    onKeyUp:function(event){

        switch(event.keyCode){
            //小键盘
            case cc.KEY.num1:
                cc.log("双倍球");
                GameControl.instance.ballCtl.AddDoubleBall();
                break;
                //扩大球
            case cc.KEY.num2:
                cc.log("扩大球");
                GameControl.instance.ballCtl.AddBallBiger(10);
                break;
            //
            case cc.KEY.num3:
                cc.log("机关枪");
                GameControl.instance.BarCtl.AddMachineGun(10);
                break;

            case cc.KEY.num4:

                let value= GameControl.instance.ballCtl.GetBallNum();
                cc.log(value);



                break;
            case cc.KEY.num5:

                cc.log("测试生产");
                cc.loader.loadRes("Prop",function (err, prefab) {
                    let prop =cc.instantiate(prefab);
                    //prop.positon =new cc.p(xValue,yValue);
                    //prop.position =cc.p(500,1500);
                    cc.log("生产成功"+prop.name+prop.positon);
                    cc.director.getScene().addChild(prop);
                });

                break;
        }
    },

    // update (dt) {},
});
